package de.mhu.mandalaui.attributes;

import java.io.PrintWriter;

public class NamedAttribute extends Attribute {

	private static boolean isFunction = false;
	
	public NamedAttribute(String id) {
		setId(id);
	}

	public NamedAttribute(String id, boolean isFunction) {
		setId(id);
		setFunction(isFunction);
	}
	
	public void renderAttributeName(PrintWriter out) {
		out.print(getId());
	}

	@Override
	public void renderFunctionImplementation(PrintWriter out) {
	}
	
	public boolean needFunctionImplementation() {
		return false;
	}

	@Override
	public void renderGet(PrintWriter out) {
		renderAttributeName(out);
		if (isFunction) out.print("()");
	}

	public static boolean isFunction() {
		return isFunction;
	}

	public static void setFunction(boolean isFunction) {
		NamedAttribute.isFunction = isFunction;
	}

}
